/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author julio
 */
@Entity
@Table(name = "calendar_dates", catalog = "transit", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CalendarDates.findAll", query = "SELECT c FROM CalendarDates c"),
    @NamedQuery(name = "CalendarDates.findByServiceId", query = "SELECT c FROM CalendarDates c WHERE c.calendarDatesPK.serviceId = :serviceId"),
    @NamedQuery(name = "CalendarDates.findByDate", query = "SELECT c FROM CalendarDates c WHERE c.calendarDatesPK.date = :date"),
    @NamedQuery(name = "CalendarDates.findByExceptionType", query = "SELECT c FROM CalendarDates c WHERE c.exceptionType = :exceptionType")})
public class CalendarDates implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CalendarDatesPK calendarDatesPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "exception_type", nullable = false, length = 2)
    private String exceptionType;

    public CalendarDates() {
    }

    public CalendarDates(CalendarDatesPK calendarDatesPK) {
        this.calendarDatesPK = calendarDatesPK;
    }

    public CalendarDates(CalendarDatesPK calendarDatesPK, String exceptionType) {
        this.calendarDatesPK = calendarDatesPK;
        this.exceptionType = exceptionType;
    }

    public CalendarDates(String serviceId, Date date) {
        this.calendarDatesPK = new CalendarDatesPK(serviceId, date);
    }

    public CalendarDatesPK getCalendarDatesPK() {
        return calendarDatesPK;
    }

    public void setCalendarDatesPK(CalendarDatesPK calendarDatesPK) {
        this.calendarDatesPK = calendarDatesPK;
    }

    public String getExceptionType() {
        return exceptionType;
    }

    public void setExceptionType(String exceptionType) {
        this.exceptionType = exceptionType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (calendarDatesPK != null ? calendarDatesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CalendarDates)) {
            return false;
        }
        CalendarDates other = (CalendarDates) object;
        if ((this.calendarDatesPK == null && other.calendarDatesPK != null) || (this.calendarDatesPK != null && !this.calendarDatesPK.equals(other.calendarDatesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.CalendarDates[ calendarDatesPK=" + calendarDatesPK + " ]";
    }
    
}
